package com.service.impl;

import com.entity.RoleAuthority;
import com.mapper.RoleAuthorityMapper;
import com.service.RoleAuthorityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author aiou
 * @since 2025-06-12
 */
@Service
public class RoleAuthorityServiceImpl implements RoleAuthorityService {

    @Autowired
    private RoleAuthorityMapper roleAuthorityMapper;

    @Override
    public boolean removeByRoleId(Integer roleId) {
        return roleAuthorityMapper.deleteByRoleId(roleId);
    }

    //根据角色id查询角色权限
    @Override
    public List<RoleAuthority> list(Integer id) {
        return roleAuthorityMapper.selectRoleAuthorityById(id);
    }

    //批量删除角色权限表信息
    @Override
    public boolean remove(Integer roleId) {
        return roleAuthorityMapper.deleteByRoleId(roleId);
    }

    //保存用户权限
    @Override
    public boolean save(RoleAuthority roleAuthority) {
        return roleAuthorityMapper.save(roleAuthority);
    }

}
